package cn.edu.njuit.springbootfilmreview.dto;

import java.io.Serializable;
import java.util.Date;

import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;

/**
 * 发布作品的信息表
 * @TableName works_info
 */
@Data
public class WorksInfo implements Serializable {
    /**
     * id
     */
    @TableId
    private Long id;

    /**
     * 作品名称
     */
    private String worksName;

    /**
     * 用户id
     */
    private Long userId;

    /**
     * 发布时间
     */
    private Date publishTime;

    /**
     * 发布照片
     */
    private String imageUrl;

    /**
     * 想法
     */
    private String text;



    private static final long serialVersionUID = 1L;

    public WorksInfo() {
    }

    public WorksInfo(String worksName, Long userId, Date publishTime, String imageUrl, String text) {
        this.worksName = worksName;
        this.userId = userId;
        this.publishTime = publishTime;
        this.imageUrl = imageUrl;
        this.text = text;
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        WorksInfo other = (WorksInfo) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getWorksName() == null ? other.getWorksName() == null : this.getWorksName().equals(other.getWorksName()))
            && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
            && (this.getPublishTime() == null ? other.getPublishTime() == null : this.getPublishTime().equals(other.getPublishTime()))
            && (this.getImageUrl() == null ? other.getImageUrl() == null : this.getImageUrl().equals(other.getImageUrl()))
            && (this.getText() == null ? other.getText() == null : this.getText().equals(other.getText()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getWorksName() == null) ? 0 : getWorksName().hashCode());
        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
        result = prime * result + ((getPublishTime() == null) ? 0 : getPublishTime().hashCode());
        result = prime * result + ((getImageUrl() == null) ? 0 : getImageUrl().hashCode());
        result = prime * result + ((getText() == null) ? 0 : getText().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", worksName=").append(worksName);
        sb.append(", userId=").append(userId);
        sb.append(", publishTime=").append(publishTime);
        sb.append(", imageUrl=").append(imageUrl);
        sb.append(", text=").append(text);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}